package top.hundreds.oasys.bean.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

@RequiredArgsConstructor
@Getter
public enum MenuStatus {

    NO_START(0,"启用"),
    STARTING(1,"禁用");

    @JsonValue
    @EnumValue
    private final Integer value;

    private final String label;

    public static MenuStatus formValue(Object o) {
        if (o != null) {
            for (MenuStatus menuStatus : values()) {
                if (menuStatus.getValue().equals(o)) {
                    return menuStatus;
                }
            }
        }
        return null;
    }

    public static MenuStatus formLabel(Object o) {
        if (o != null) {
            for (MenuStatus menuStatus : values()) {
                if(menuStatus.getLabel().equals(o)){
                    return menuStatus;
                }
            }
        }
        return null;
    }
}
